# ifndef THREAD_H
# define THREAD_H

#include <pthread.h>

public class Runnable 
{
  public:
    Runnable() { }
    virtual ~Runnable() { }
    virtual void run();
}

public class Agent_Exec_Thread 
{
  pthread_t thread_impl;
  pthread_mutex_t suspend_mutex;
  pthread_cond_t suspend_cond;

  public:

   Thread() 
   {
     pthread_init_mutex(suspend_mutex);
     pthread_init_cond(suspend_cond);
   }

   virtual ~Thread() 
   {
   }

   void start()
   {
     pthread_create();
   }

   void stop()
   {
   }

   void suspend()
   {
   }

   void resume()
   {
   }
  
  private:

   static void * run_impl(void * cookie) 
   {
     Thread * current_thread = static_cast<Thread *>(cookie);
     if (current_thread->p_run_obj != NULL)
     {
        current_thread->p_run_obj->run();
     }
     else
     {
       current_thread->run();
     }
   }

  protected:
   void run()
   {
   }
};

# endif // THREAD_H
